import turtle as t

def up():
    t.fd(1)

def down():
    t.bk(1)

def left():
    t.lt(1)

def right():
    t.right(1)

def penup():
    t.penup()

def pendown():
    t.pendown()

t.listen()
t.onkeypress(up, 'w')
t.onkeypress(down, 's')
t.onkeypress(left, 'a')
t.onkeypress(right, 'd')
t.onkeypress(penup, 'q')
t.onkeypress(pendown, 'e')
t.mainloop()
